package fr.univ_tln.inf9.exaplanning.controleur.cours;
import java.util.Date;

import fr.univ_tln.inf9.exaplanning.api.cours.TimeSlot;

/**
 * @author Ventura
 *
 */

public class TimeSlotController {
	
	public TimeSlotView listView = null;
	
	private TimeSlot timeSlot = null;
	
	public TimeSlotController (TimeSlot timeSlot){
		this.timeSlot = timeSlot;
		
		/*fieldView = new JFrameFieldNom(this, user.getNom());
		listView = new JFrameListNom(this, user.getNom());*/
		
		addListenersToStart_time();
		addListenersToEnd_time();
		addListenersToDay();
	}

	private void addListenersToStart_time() {
		timeSlot.addStart_timeListener(listView);
		
	}
	
	private void addListenersToEnd_time() {
		timeSlot.addEnd_timeListener(listView);
		
	}
	
	private void addListenersToDay() {
		timeSlot.addDayListener(listView);
		
	}
	
	public void displayViews(){
		listView.display();
	}
	
	public void closeViews(){
		listView.close();
	}
	
	public void notifyStart_timeChanged(Date start_time){
		timeSlot.setStart_time(start_time);
	}
	
	public void notifyEnd_timeChanged(Date end_time){
		timeSlot.setEnd_time(end_time);
	}
	
	public void notifyDayChanged(String day){
		timeSlot.setDay(day);
	}

}
